/*  ___ _  ____  __ _  _    ___       _ _          
 * | _ \ |/ /  \/  | \| |  / _ \ _ _ | (_)_ _  ___ 
 * |  _/ ' <| |\/| | .` | | (_) | ' \| | | ' \/ -_)
 * |_| |_|\_\_|  |_|_|\_|  \___/|_||_|_|_|_||_\___|
 */
#ifndef __PKMNONLINE_ENGINE_H__
#define __PKMNONLINE_ENGINE_H__
#include <windows.h>
#include <SDL.h>	/* SDL Library */
#include <gl/gl.h>	/* OpenGL */
#include <gl/glu.h> /* OpenGL Utility Library */
#include <il/il.h>	/* DevIL Image Library */
#include <stdio.h>
#include "scene.h"
#include "map.h"
#include "actor.h"
#include "font.h"


class CEngine {
public:
	~CEngine();

	void Think(int tick);
	void HandleInput();
	void HandleEvent(SDL_Event *pEvent);
	
	inline bool IsRunning() const { return m_bRunning; }
	inline void	Terminate() { m_bRunning = false; }

	static CEngine *Initialize(HWND hWnd, HINSTANCE hAppInstance, int nWidth, int nHeight);
	static void Deinitialize();
	static CEngine *GetSingleton() { return m_pSingleton; }

	CScene *GetScene() const { return m_pScene; }
	CFont *GetFont() const { return m_pFont; }

private:
	CEngine(HWND hWnd, HINSTANCE hAppInstance, int nWidth, int nHeight);

	void Initialize_Graphics();
	void Initialize_Audio();

	void Render();

	HWND		 m_hWnd;
	HINSTANCE	 m_hAppInstance;
	bool		 m_bRunning;
	int			 m_nWidth, m_nHeight;
	HDC			 m_hDc;
	HGLRC		 m_hRc;
	CActor		*m_pPlayer;
	CAnimation  *m_pPlayerAnimation;
	CScene      *m_pScene;
	CFont       *m_pFont;

	SDL_Surface *m_pScreen;

	//CClient *m_pClient;



	static CEngine *m_pSingleton;
};

#endif /* __PKMNONLINE_ENGINE_H__ */
